import App from './App'
import uviewPlus from './uni_modules/uview-plus'
import defaults from './api/request.js'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
Vue.use(uviewPlus)
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  app.use(uviewPlus)
  app.provide('$defaults', defaults)
  // 提供更方便的访问方式
  app.provide('$imgUrl', defaults.defaults.imgurl)
  app.provide('$baseUrl', defaults.defaults.baseUrl)
  app.provide('$serverAddress', defaults.defaults.server_address)
  return {
    app
  }
}
// #endif